//////////////////////////////////////////////////////////////////////
//  Jack McCaffery
//  11-10-2014
//////////////////////////////////////////////////////////////////////

#include "topicModel/samples.H"

using namespace std;


SingleSample::SingleSample () :
	row (0),
	col (0),
	oldValue (0),
	newValue (0),
	probability (-1),
	logProbability (-1)
{

}

SingleSample::~SingleSample ()
{

}


///////////////////////////////////////////////////////////////////////////
Sample::~Sample ()
{

}

Sample::Sample () :
	samplePoints (0)
{

}

double Sample::transProbability () const
{
	double total = 1.0;

	for (unsigned i = 0; i < samplePoints.size (); ++i)
		total *= samplePoints[i].probability;

	return total;
}

double Sample::transLogProbability () const
{
	double total = 0.0;

	for (unsigned i = 0; i < samplePoints.size (); ++i)
		total += samplePoints[i].logProbability;

	return total;
}

void Sample::addSample (SingleSample const &s_)
{
	samplePoints.push_back (s_);
}

vector<SingleSample> const &Sample::getSamples () const
{
	return samplePoints;
}
